﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NhanAi.Entity;
using NhanAi.DAO;
namespace NhanAi.Public
{
    public partial class Follow : PublicBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnFollow_Click(object sender, EventArgs e)
        {
            UserDao dao = new UserDao();
            User u = new User();
            u.UserLogin = txtEmail.Text;
            u.Email = u.UserLogin;
            u.UserPassword = "";
            u.UserRole = NhanAi.App_Code.NAConstants.ROLE_FOLLOWER;
            u.RegistedDate = DateTime.Now;
            u.ActivationKey = "";
            
            u.Nicename = "";
            u.Status = 0;
            //bool rs = false;
            try
            {
                dao.Create(u);
                Label1.Text = GetGlobalResourceObject("HmLanguage","thanks").ToString();
                txtEmail.Text = "";
                btnFollow.Enabled = false;
            }
            catch (Exception ex) { Label1.Text = GetGlobalResourceObject("HmLanguage", "comment_fail").ToString(); }
            
        }
    }
}